<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title> - 钻石配置</title>
	    <meta name="keywords" content="">
	    <meta name="description" content="">
	    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	    <link href="__STATIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	    <link href="__STATIC__/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	    <link href="__STATIC__/css/animate.css" rel="stylesheet">
	    <link href="__STATIC__/css/style.css?v=4.1.0" rel="stylesheet">
	    <link href="__STATIC__/css/new_file.css" rel="stylesheet">
	</head>
	<body class="gray-bg">
		<div class="wrapper wrapper-content  animated fadeInRight">
			<div class="row">
				<div class="col-sm-12">
					<div class="ibox ">
						<div class="ibox-title">
							<h5>钻石配置</h5>
						</div>
						<div class="toogl_body">
	                    	<a href="Club.html"><button type="button" class="btn btn-w-m btn-bt btn-white">亲友圈管理</button></a>
	                    	<a href="Club_configure.html"><button type="button" class="btn btn-w-m btn-info btn-bt">蓝钻商城配置</button></a>
							<a href="Club_goldcoin.html"><button type="button" class="btn btn-w-m btn-white btn-bt">黄钻商城配置</button></a>
							<a href="Club_vipcard.html"><button type="button" class="btn btn-w-m btn-white btn-bt">会员卡商城配置</button></a>
	                    	<a href="Club_establish.html"><button type="button" class="btn btn-w-m btn-white btn-bt">创建亲友圈</button></a>

	                    	<!--<a href="Club_grant.html"><button type="button" class="btn btn-w-m btn-white btn-bt">金币发放</button></a>-->
	                    	<a href="Club_conf.html"><button type="button" class="btn btn-w-m btn-white btn-bt">亲友圈配置</button></a>
							<a href="Club_from.html"><button type="button" class="btn btn-w-m btn-white btn-bt">房间配置</button></a>
	                    	<hr style="clear: both;"/>
	                    	<a><button type="button" class="btn btn-w-m btn-info" data-toggle="modal" data-target="#myModal">添加商品</button></a>
	                    	<a href="Club_configure_1.html"><button type="button" class="btn btn-w-m btn-white">历史记录</button></a>
							<div class="ibox-content ibox-jqGrid">
		                        <div class="jqGrid_wrapper">
		                            <table id="table_list_1"></table>
		                            <div id="pager_list_1"></div>
		                        </div>
		                    </div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 添加  -->
		<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border float-pad">
								<div class="ibox-content">
									<form class="form-horizontal">
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">商品ID：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" class="form-control" readonly="readonly">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">商品位置：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" class="form-control" id="add_goods_position">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">蓝钻数量：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" class="form-control" id="add_number_diamonds">
			                                </div>
			                            </div>
										<div class="form-group">
											<label class="col-sm-2 control-label">赠钻数量：</label>
											<div class="col-sm-8">
												<input type="text" class="form-control" id="Give">
											</div>
										</div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">价格(元)：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" class="form-control" id="add_price">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">开启时间：</label>
			                                <div class="col-sm-8">
			                                    <select class="form-control form-consele1">
												   <option value="0">永久</option>
												   <option value="1">限时</option>
												</select>
			                                    <input type="text" class="form-control clo-sj" id="time1" placeholder="选取时间段" readonly="readonly">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">销售库存：</label>
			                                <div class="col-sm-8">
			                                    <select class="form-control form-consele2" id="number">
												   <option value="0">不限</option>
												   <option value="1">限量</option>
												</select>
			                                    <input type="text" class="form-control clo-xl" placeholder="限量数量" id="add_sales_inventory">
			                                </div>
			                            </div>
										<div class="form-group">
											<label class="col-sm-2 control-label">是否热卖：</label>
											<div class="col-sm-8">
												<select class="form-control" id="hot_sale" >
													<option value="0">否</option>
													<option value="1">是</option>
												</select>
											</div>
										</div>
			                        </form>
								</div>
							</div>
							<div class="ibox-butz">
								<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="President_mall_configuration()">
								<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--添加 end-->
		<!-- 修改  -->
		<div id="myModal2" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border float-pad">
								<div class="ibox-content">
									<form class="form-horizontal">
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">商品ID：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" readonly="readonly" id="save_goods_id"> 
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">商品位置：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" id="save_goods_position">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">蓝钻数量：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" id="save_number_diamonds">
			                                </div>
			                            </div>
										<div class="form-group">
											<label class="col-sm-2 control-label">赠钻数量：</label>
											<div class="col-sm-8">
												<input type="text" value="" class="form-control" id="save_Give">
											</div>
										</div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">价格（元）：</label>
			                                <div class="col-sm-8">
			                                    <input type="text" value="" class="form-control" id="save_price">
			                                </div>
			                            </div>
			                             <div class="form-group">
			                                <label class="col-sm-2 control-label">开启时间：</label>
			                                <div class="col-sm-8">
			                                    <select class="form-control form-consele1s" id="save_time">
												   <option value="0">永久</option>
												   <option value="1">限时</option>
												</select>
			                                    <input type="text" class="form-control clo-sjs" id="time2" placeholder="选取时间段" readonly="readonly">
			                                </div>
			                            </div>
			                            <div class="form-group">
			                                <label class="col-sm-2 control-label">销售库存：</label>
			                                <div class="col-sm-8">
			                                    <select class="form-control form-consele2s" id="save_number" >
												   <option value="0">不限</option>
												   <option value="1">限量</option>
												</select>
			                                    <input type="text" class="form-control clo-xls" placeholder="限量数量" id="save_sales_inventory">
			                                </div>
			                            </div>
										<div class="form-group">
											<label class="col-sm-2 control-label">是否热卖：</label>
											<div class="col-sm-8">
												<select class="form-control form-consele2s" id="save_hot_sale" >
													<option value="0">否</option>
													<option value="1">是</option>
												</select>
											</div>
										</div>

			                        </form>
								</div>
							</div>
							<div class="ibox-butz">
								<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="President_mall_modify()">
								<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--修改 end-->
		
		<!-- 下架   -->
		<div id="myModal3" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border float-pad">
								<div class="ibox-content">
									<form class="form-horizontal">
										<input type="hidden" name="" id="mshelves">
			                            <div class="form-texcan">确认下架该商品？</div>
			                        </form>
								</div>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="President_goods_mshelves()">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--下架 end-->
		<!-- 上架   -->
		<div id="myModal4" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border float-pad">
								<div class="ibox-content">
									<form class="form-horizontal">
										<input type="hidden" name="" id="shelves">
			                            <div class="form-texcan">是否重新上架该商品？</div>
			                        </form>
								</div>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="President_goods_shelves()">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--上架 end-->
		<!-- 删除   -->
		<div id="myModal5" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div id="gray_Nr">
				<div class="col-sm-6">
					<div class="ibox float-e-margins float-e-margins-2">
						<div class="ibox-title">
							<h5>提示消息</h5>
							<div class="ibox-tools" data-dismiss="modal">
								<a class="close-link">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="panel-body">
							<div class="ibox float-e-margins float-e-border float-pad float-zjb">
								<div class="ibox-content">
									<form class="form-horizontal">
										<input type="hidden" name="" id="del">
			                            <div class="form-texcan">删除将无法恢复</div>
			                        </form>
								</div>
							</div>
						</div>
						<div class="ibox-butz">
							<input class="btn btn-w-m btn-info" type="button" value="确定" onclick="President_goods_del()">
							<input class="btn btn-w-m" type="button" data-dismiss="modal" value="取消">
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--删除 end-->
<!--手机导航-->
<div class="to-fdh" style="display: none;">
	<img class="to-imgd" src="__STATIC__/img/phonedh.jpg">
	<div class="mob-nrlb">
		<ul>
			<li>
				<a class="mob-nrdh">管理</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('Player/gameplayer')}">玩家管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('system/notice')}">公告管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('email/mail')}">邮件管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Club/club')}">亲友圈管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Money/money')}">提现管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Order/order')}">订单管理</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh">数据</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('data/datagk')}">概況</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datawf')}">玩法</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datalc')}">留存</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datass')}">实时数据</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataczfx')}">充值分析</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataclub')}">亲友圈统计</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/president')}">高级会长</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/regionaldata')}">地区数据</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh mob-qbh">权限</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_list')}">权限管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_group')}">用户组管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('account/account_details')}">后台账号管理</a>
					</li>
				</ul>
			</li>
		</ul>
	</div>
</div>
<div id="zkbg">
	<img src="__STATIC__/img/dp.gif">
</div>
<div class="vnl-zz" style="display:none">
	<div><img src="__STATIC__/img/bqhp.gif"></div>
</div>
<!--手机适配-->
	    <script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
	    <script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
	    <script src="__STATIC__/js/plugins/peity/jquery.peity.min.js"></script>
	    <script src="__STATIC__/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
	    <script src="__STATIC__/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
	    <script src="__STATIC__/js/content.js?v=1.0.0"></script>
    	<script src="__STATIC__/js/plugins/laydate/laydate.js"></script>
		<script>
            //手机适配
            $(function(){
                if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                    $("head").append("<link>");
                    var css = $("head").children(":last");
                    css.attr({
                        rel:  "stylesheet",
                        type: "text/css",
                        href: "__STATIC__/css/phone_sp.css"
                    });
                    var mql = window.matchMedia("(orientation: portrait)");
                    if(mql.matches) { //竖屏样式
                        $(".vnl-zz").show();
                        $(".to-fdh").hide();
                    }else{
                        $(".to-fdh").show();
                        $("html").width("100%");
                        $("body").width("100%");
                    }
                    mql.addListener(function(m) {
                        if(m.matches) {
                            // 改变到直立方向
                            $(".vnl-zz").show();
                            $(".to-fdh").hide();
                        }
                        else {
                            $(".to-fdh").show();
                            $(".vnl-zz").hide();
                            $("html").width("100%");
                            $("body").width("100%");
                        }
                    });
                }
            });
            //导航显示展开
            $(".mob-nrdh").click(function(){
                $(this).next().toggle(".mob-nryc");
            });
            $(".to-imgd").click(function(){
                $(this).next().toggle(".mob-nrlb");
            });
            //手机适配end
		// goods_position商品位置
		// number_diamonds钻石数量
		// price价格
		// start_time开始时间
		// end_time截止时间
		// sales_inventory销售库存
		// exclusive_goods是否为专属商品
		// club_id亲友圈id
		// sales_inventory销售库存
		function _getMessage(t) {
				var id = $(t).parent().parent().children().eq(0).html();//商品id
				var goods_position = $(t).parent().parent().children().eq(1).html();//商品位置
				var number_diamonds = $(t).parent().parent().children().eq(2).html();//钻石数量
            	var give = $(t).parent().parent().children().eq(3).html();//钻石数量
				var price = $(t).parent().parent().children().eq(4).html();//价格
				var time = $(t).parent().parent().children().eq(5).html();//开始时间
				var club_gold = $(t).parent().parent().children().eq(6).html();//销售库存
				var exclusive_goods = $(t).parent().parent().children().eq(8).html();//专属商品
				var club_id = $(t).parent().parent().children().eq(9).html();//亲友圈id
            	var hot_sale = $(t).parent().parent().children().eq(7).html();//是否热卖
				// $('#Club_dissolution_id').val(id);//亲友圈解散id
				$('#save_goods_id').val(id);//修改商品id
				$('#save_goods_position').val(goods_position);//修改商品位置
				$('#save_number_diamonds').val(number_diamonds);//修改钻石数量
				$('#save_price').val(price);//修改价格
            	$('#save_Give').val(give);//赠钻数量
				
				if(time == "永久"){
					var time_limit= $('#save_time').val(0);
					time_limit.attr("selected", "selected");
					$('.clo-sjs').hide();
					$('#time2').val();
				}else{
					var time_limit= $('#save_time').val(1);
					time_limit.attr("selected", "selected");
					$('.clo-sjs').show();
					$('#time2').val(time);
				}
				if(club_gold == "不限"){
					var save_number= $('#save_number').val(0);
					save_number.attr("selected", "selected");
					$('.clo-xls').hide();
					$('#save_sales_inventory').val();
				}else{
					var save_number= $('#save_number').val(1);
					save_number.attr("selected", "selected");
					$('.clo-xls').show();
					$('#save_sales_inventory').val(club_gold);
				}
				if(exclusive_goods == "0"){
					var exclusive_goods= $('#save_exclusive_goods').val(0);
					exclusive_goods.attr("selected", "selected");
					$('.clo-xl2s').hide();
					$('#save_club_id').val();
				}else{
					var exclusive_goods= $('#save_exclusive_goods').val(1);
					exclusive_goods.attr("selected", "selected");
					$('.clo-xl2s').show();
					$('#save_club_id').val(club_id);
				}
				if(hot_sale == "否"){
					var hot_sale= $('#save_hot_sale').val(0);
                    hot_sale.attr("selected", "selected");
					// $('.clo-xl2s').hide();
					// $('#save_club_id').val();
				}else{
					var hot_sale= $('#save_hot_sale').val(1);
                    hot_sale.attr("selected", "selected");
					// $('.clo-xl2s').show();
					// $('#save_club_id').val(club_id);
				}
				// if(club_id == ""){
				// 	var exclusive_goods= $('#save_exclusive_goods').val(0);
				// 	exclusive_goods.attr("selected", "selected")
				// }else{
				// 	var exclusive_goods= $('#save_exclusive_goods').val(1);
				// 	exclusive_goods.attr("selected", "selected")
				// }
				
				$('#shelves').val(id);//商品上架id
				$('#mshelves').val(id);//商品下架id

				$('#del').val(id);//商品删除id
		}
		//商品添加
		function President_mall_configuration(){
				var goods_position = $('#add_goods_position').val();
				var number_diamonds = $('#add_number_diamonds').val();
				var price = $('#add_price').val();
				var time = $('#time1').val();
				var start_time = time.substring(0,19);
                var end_time = time.substring(22);
				var sales_inventory = $('#add_sales_inventory').val();
				var exclusive_goods = $('#add_exclusive_goods').val();
				var club_id = $('#add_club_id').val();
				var sales_inventory = $('#add_sales_inventory').val();
				var number = $('#number').val();
            	var Give = $('#Give').val();
            	var goods_type = 10001;
            	var hot_sale = $('#hot_sale').val();
				if(number == 0){
					var sales_inventory = -1;
				}
				
				
			    $.ajax({
					type: "post",
					url: "__URL__/President_mall_configuration",
					data: {
						'goods_position':goods_position,
						'number_diamonds':number_diamonds,
						'price':price,
						'start_time':start_time,
						'end_time':end_time,
						'sales_inventory':sales_inventory,
						'exclusive_goods':exclusive_goods,
						'club_id':club_id,
						'sales_inventory':sales_inventory,
						'goods_type':goods_type,
                        'hot_sale':hot_sale,
						'Give':Give
					},
					dataType: "json",
					success: function(e) {
						// console.log(e);
						alert(e.msg);
						location.reload();
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
		}
		//金币商城 商品下架
			function President_goods_mshelves(){
				var id = $("#shelves").val();
                var goods_position = $('#save_goods_position').val();
                var number_diamonds = $('#save_number_diamonds').val();
                var price = $('#save_price').val();
                var time = $('#time2').val();
                var sales_inventory = $('#savesales_inventory').val();
                var exclusive_goods = $('#save_exclusive_goods').val();
                var club_id = $('#save_club_id').val();
                var sales_inventory = $('#save_sales_inventory').val();
                var number = $('#save_number').val();
                var hot_sale = $('#save_hot_sale').val();
                var save_time = $('#save_time').val();
                var goods_type = 10001;
                if(number == 0){
                    var sales_inventory = -1;
                }
                if(save_time != 0){
                    var start_time = time.substring(0,19);
                    var end_time = time.substring(22);
                }else{
                    var time = "0000-00-00 00:00:00 - 0000-00-00 00:00:00";
                    var start_time = "";
                    var end_time ="";
                }
                if(exclusive_goods == 0){
                    var club_id = "";
                }
				console.log(id);
			    $.ajax({
					type: "post",
					url: "__URL__/President_goods_mshelves",
					data: {
						'id':id,
                        'goods_position':goods_position,
                        'number_diamonds':number_diamonds,
                        'price':price,
                        'start_time':start_time,
                        'end_time':end_time,
                        'sales_inventory':sales_inventory,
                        'exclusive_goods':exclusive_goods,
                        'club_id':club_id,
                        'hot_sale':hot_sale,
                        'goods_type':goods_type,
					},
					dataType: "json",
					success: function(e) {
						// console.log(e);
						alert(e.msg);
                        $('#myModal3').modal('hide');
                        $("#table_list_1").jqGrid('setGridParam',{
                            url:'__URL__/President_goods_display',
                            datatype:'json',
                            postData:{'goods_type':10001},
                            page:1
                        }).trigger("reloadGrid"); //重新载入
						// location.reload();
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
		}
		//金币商城 商品上架
			function President_goods_shelves(){
				var id = $("#mshelves").val();
                var goods_position = $('#save_goods_position').val();
                var number_diamonds = $('#save_number_diamonds').val();
                var price = $('#save_price').val();
                var time = $('#time2').val();
                var exclusive_goods = $('#save_exclusive_goods').val();
                var club_id = $('#save_club_id').val();
                var sales_inventory = $('#save_sales_inventory').val();
                var number = $('#save_number').val();
                var save_time = $('#save_time').val();
                var hot_sale = $('#save_hot_sale').val();
                var goods_type = 10001;
                if(number == 0){
                    var sales_inventory = -1;
                }
                if(save_time != 0){
                    var start_time = time.substring(0,19);
                    var end_time = time.substring(22);
                }else{
                    var time = "0000-00-00 00:00:00 - 0000-00-00 00:00:00";
                    var start_time = "";
                    var end_time ="";
                }
                if(exclusive_goods == 0){
                    var club_id = "";
                }
			    $.ajax({
					type: "post",
					url: "__URL__/President_goods_shelves",
					data: {
						'id':id,
                        'goods_position':goods_position,
                        'number_diamonds':number_diamonds,
                        'price':price,
                        'start_time':start_time,
                        'end_time':end_time,
                        'sales_inventory':sales_inventory,
                        'exclusive_goods':exclusive_goods,
                        'club_id':club_id,
                        'hot_sale':hot_sale,
                        'goods_type':goods_type,
					},
					dataType: "json",
					success: function(e) {
						// console.log(e);
						alert(e.msg);
                        $('#myModal4').modal('hide');
                        $("#table_list_1").jqGrid('setGridParam',{
                            url:'__URL__/President_goods_display',
                            datatype:'json',
                            postData:{'goods_type':10001},
                            page:1
                        }).trigger("reloadGrid"); //重新载入
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
			}
		//商品修改
		function President_mall_modify(){
				var id = $('#save_goods_id').val();
				var goods_position = $('#save_goods_position').val();
				var number_diamonds = $('#save_number_diamonds').val();
				var price = $('#save_price').val();
				var time = $('#time2').val();
				var sales_inventory = $('#savesales_inventory').val();
				var exclusive_goods = $('#save_exclusive_goods').val();
				var club_id = $('#save_club_id').val();
				var sales_inventory = $('#save_sales_inventory').val();
				var number = $('#save_number').val();
            	var Give = $('#save_Give').val();
				var save_time = $('#save_time').val();
            	var hot_sale = $('#save_hot_sale').val();

           		var goods_type = 10001;
				if(number == 0){
					var sales_inventory = -1;
				}
				if(save_time != 0){
					var start_time = time.substring(0,19);
	                var end_time = time.substring(22);
				}else{
					var time = "0000-00-00 00:00:00 - 0000-00-00 00:00:00";
					var start_time = "";
	                var end_time ="";
				}
				if(exclusive_goods == 0){
					var club_id = "";
				}
				// console.log(time);
			    $.ajax({
					type: "post",
					url: "__URL__/President_mall_modify",
					data: {
						'goods_id':id,
						'goods_position':goods_position,
						'number_diamonds':number_diamonds,
						'price':price,
						'start_time':start_time,
						'end_time':end_time,
						'sales_inventory':sales_inventory,
						'exclusive_goods':exclusive_goods,
						'club_id':club_id,
                        'hot_sale':hot_sale,
                        'goods_type':goods_type,
                        'Give':Give
					},
					dataType: "json",
					success: function(e) {
						// console.log(e);
						alert(e.msg);
						// location.reload();
                        $('#myModal2').modal('hide');
						// $('myModal2').
                        $("#table_list_1").jqGrid('setGridParam',{
                            url:'__URL__/President_goods_display',
                            datatype:'json',
                            postData:{'goods_type':10001},
                            page:1
                        }).trigger("reloadGrid"); //重新载入
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
		}
		//会长商城 商品删除
			function President_goods_del(){
				var id = $("#del").val();
                var goods_position = $('#save_goods_position').val();
                var number_diamonds = $('#save_number_diamonds').val();
                var price = $('#save_price').val();
                var time = $('#time2').val();
                var sales_inventory = $('#savesales_inventory').val();
                var exclusive_goods = $('#save_exclusive_goods').val();
                var club_id = $('#save_club_id').val();
                var hot_sale = $('#save_hot_sale').val();
                var number = $('#save_number').val();
                var save_time = $('#save_time').val();
                var goods_type = 10001;
                if(number == 0){
                    var sales_inventory = -1;
                }
                if(save_time != 0){
                    var start_time = time.substring(0,19);
                    var end_time = time.substring(22);
                }else{
                    var time = "0000-00-00 00:00:00 - 0000-00-00 00:00:00";
                    var start_time = "";
                    var end_time ="";
                }
                if(exclusive_goods == 0){
                    var club_id = "";
                }
				console.log(id);
			    $.ajax({
					type: "post",
					url: "__URL__/President_goods_del",
					data: {
						'id':id,
                        'goods_position':goods_position,
                        'number_diamonds':number_diamonds,
                        'price':price,
                        'start_time':start_time,
                        'end_time':end_time,
                        'sales_inventory':sales_inventory,
                        'exclusive_goods':exclusive_goods,
						'goods_type':goods_type,
                        'club_id':club_id,
                        'hot_sale':hot_sale,
					},
					dataType: "json",
					success: function(e) {
						// console.log(e);
						alert(e.msg);
                        $('#myModal5').modal('hide');
                        $("#table_list_1").jqGrid('setGridParam',{
                            url:'__URL__/President_goods_display',
                            datatype:'json',
                            postData:{'goods_type':10001},
                            page:1
                        }).trigger("reloadGrid"); //重新载入
					},
					error: function(e) {
						// console.log(e);
						alert(e.msg);
					}
				});
			}
        $(document).ready(function () {
        	
			$('.clo-sj').hide();
			$('.clo-xl').hide();
			$('.clo-xl2').hide();
        	$('.form-consele1').on('change',function(){
        		if ($('.form-consele1').val() == '0') {
        			$('.clo-sj').hide();
        		} else{
        			$('.clo-sj').show();
        		}
        	});
        	$('.form-consele2').on('change',function(){
        		if ($('.form-consele2').val() == '0') {
        			$('.clo-xl').hide();
        		} else{
        			$('.clo-xl').show();
        		}
        	});
        	$('.form-consele3').on('change',function(){
        		if ($('.form-consele3').val() == '0') {
        			$('.clo-xl2').hide();
        		} else{
        			$('.clo-xl2').show();
        		}
        	});
        	
        	
			$('.clo-sjs').hide();
			$('.clo-xls').hide();
			$('.clo-xl2s').hide();
        	$('.form-consele1s').on('change',function(){
        		if ($('.form-consele1s').val() == '0') {
        			$('.clo-sjs').hide();
        		} else{
        			$('.clo-sjs').show();
        		}
        	});
        	$('.form-consele2s').on('change',function(){
        		if ($('.form-consele2s').val() == '0') {
        			$('.clo-xls').hide();
        		} else{
        			$('.clo-xls').show();
        		}
        	});
        	$('.form-consele3s').on('change',function(){
        		if ($('.form-consele3s').val() == '0') {
        			$('.clo-xl2s').hide();
        		} else{
        			$('.clo-xl2s').show();
        		}
        	})
            $.jgrid.defaults.styleUI = 'Bootstrap';
            // Examle data for jqGrid
            var mydata = [
                {
                    id: "1",
                    invdate: "2010-05-24",
                    name: "test",
                    note: "note",
                    tax: "10.00",
                    total: "2111.00"
                }
            ];

            $("#table_list_1").jqGrid({
                url:'__URL__/President_goods_display',
                postData:{'goods_type':10001},
                datatype: "json",
                mtype: 'POST',
                height: 450,
                autowidth: true,
                shrinkToFit: true,
                rowNum: 20,
                rowList: [20,50,100],
                colNames: ['商品ID', '商品位置', '蓝钻石数量', '赠钻数量','价格（元）', '开启时间', '销售库存','是否热卖','修改','下架','删除'],
                colModel: [
                    {
                        name: 'id',
                        index: 'id',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'goods_position',
                        index: 'goods_position',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'goods_number',
                        index: 'goods_number',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'give',
                        index: 'give',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'price',
                        index: 'price',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'time',
                        index: 'time',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
      //                   formatter: function(sales_inventory) {
      //                   	if(exclusive_goods == "0000-00-00 00:00:00"){
      //                   		return '<span style="color:#00BFFF">否</span>'
      //                   	}else{
      //                   		return '<span style="color:#FF0000">是</span>'
      //                   	}
						// },
                        align:'center'
                    },
                    {
                        name: 'goods_count',
                        index: 'goods_count',
                        width: 60,
                        sorttype: "int",
                        sortable: false,
                        align:'center'
                    },
                    {
                        name: 'hot_sale',
                        index: 'hot_sale',
                        width: 60,
                        formatter: function(hot_sale) {
                            switch(Number(hot_sale)){
                                case 0:
                                 	return '否';
                                case 1:
                                    return '是';
                            }
                            // return '<input type="button" value="下架" id="" data-toggle="modal" data-target="#myModal3" class="btn btn-info"/>';
                        },
                        align:'center'
                    },
                    {
						name: 'isfinish',
						index: 'isfinish',
						width: 60,
						formatter: function() {
							return '<input type="button" value="修改" id="" data-toggle="modal" data-target="#myModal2" class="btn btn-info" onclick="_getMessage(this)"/>';
						},
                        align:'center'
					},
                    {
						name: 'status',
						index: 'status',
						width: 60,
						formatter: function(status) {
							switch(Number(status)){
									case 0:
										return '<input type="button" style="background:	#FF8247" value="上架" id="" data-toggle="modal" data-target="#myModal4" class="btn btn-info" onclick="_getMessage(this)"/>';
									case 1:
										return '<input type="button" value="下架" id="" data-toggle="modal" data-target="#myModal3" class="btn btn-info" onclick="_getMessage(this)"/>';
							}
							// return '<input type="button" value="下架" id="" data-toggle="modal" data-target="#myModal3" class="btn btn-info"/>';
						},
                        align:'center'
					},
                    {
						name: 'isfinish',
						index: 'isfinish',
						width: 60,
						formatter: function() {
							return '<input type="button" value="删除" id="" data-toggle="modal" data-target="#myModal5" class="btn btn-danger" onclick="_getMessage(this)"/>';
						},
                        align:'center'
					}
                ],
                pager: "#pager_list_1",
                loadonce: true,
                viewrecords: true,
                caption: "钻石配置",
                hidegrid: false
            });
            $("#jd").hide();
            $(function(){
            	$("#jd").click(function(){
            		$("#jd").hide();
            		$("#dj").show();
            	});
            	$("#dj").click(function(){
            		$("#dj").hide();
            		$("#jd").show();
            	});
            });
            $("#fj").hide();
            $(function(){
            	$("#fj").click(function(){
            		$("#fj").hide();
            		$("#jj").show();
            	});
            	$("#jj").click(function(){
            		$("#jj").hide();
            		$("#fj").show();
            	});
            });
            $('.form-conselein').hide();
			$('.form-consele').on('change',function(){
				if ($('.form-consele').val() == '0') {
					$('.form-conselein').hide();
				} else{
					$('.form-conselein').show();
				}
			})
            
			setTimeout(function(){
                var width = $('.jqGrid_wrapper').width();
                $('#table_list_1').setGridWidth(width);
			},500);
            
            
		    laydate.render({
		      elem: '#time1'
		      ,type: 'datetime'
		      ,range: true
		    });
		    laydate.render({
		      elem: '#time2'
		      ,type: 'datetime'
		      ,range: true
		    });
        });
    </script>


	</body>

</html>